package WaiBao;

import java.util.Arrays;

public class XueWenWen {
    public static void main(String[] args) {
        String[] name = {"李大文(班长)", "黄志勇(学习委员)", "魏大勋(纪律委员)", "欧豪辰(体育委员)", "张大虎", "白小明", "何治国", "赵天", "李向阳", "燕双鹰", "魏大标", "李志远",
                "赵匡胤", "李世民", "雍正", "乾隆", "肖战", "王俊凯", "王源", "鹿晗", "张艺兴", "蔡徐坤", "何炅", "谢娜", "杜海涛", "何晨光", "李二牛", "何价",
                "王一博", "薛文文(学生)"};//考生本人: 薛文文(学生)
        int[] Age = {18, 19, 18, 18, 18, 19, 19, 18, 18, 19, 18, 19, 18, 20, 19, 19, 18, 18, 18, 18, 19, 19, 20, 20, 18, 18, 18, 20, 19, 19};
        double[] a1 = {77, 78, 94, 88, 78, 68, 68, 89, 89, 90, 98, 87, 85, 79, 65, 68, 69, 99, 96, 88, 92, 91, 65, 81, 65, 77, 78, 59, 72, 93};
        double[] a2 = {78, 81, 79, 98, 88, 79, 78, 99, 90, 60, 88, 74, 67, 75, 65, 65, 86, 79, 66, 68, 92, 98, 65, 75, 79, 88, 71, 98, 61, 92};
        double[] a3 = {79, 79, 70, 85, 79, 64, 78, 89, 80, 60, 93, 87, 85, 75, 65, 68, 69, 69, 96, 93, 92, 81, 95, 95, 68, 85, 77, 85, 78, 93};

        double get1;//代表每个学生的总分
        double pj;//代表每个学生的平均分
//        for (int i = 0; i < 30; i++) {
//            get1 = a1[i] + a2[i] +a3[i];
//            pj = (get1* 1.0) / 3;
//            System.out.println(name[i] + "的总分为:" + get1);
//            System.out.println(name[i] + "的平均分为:" +pj);
//        }
//
//        double res1 = 0,avg1 = 0;
//        double[] shuzu1 = new double[30];
//        for (int i = 0; i < 30; i++) {
//            res1 = a1[i] + a2[i] + a3[i];
//            avg1 = (res1 * 1.0) / 3;
//            shuzu1[i] = avg1;
//        }
//
//        for (int i = 0; i < shuzu1.length - 1; i++) {
//            for (int j = 0; j < shuzu1.length - i - 1; j++) {
//                if (shuzu1[j] < shuzu1[j + 1]) {
//                    double tep = shuzu1[j];
//                    shuzu1[j] = shuzu1[j + 1];
//                    shuzu1[j + 1] = tep;
//                }
//            }
//        }
//        System.out.println("前十名同学的成绩为:");
//        for (int i = 0; i < 10; i++) {
//            System.out.println(shuzu1[i]);
//        }


        double j1 = 0, j2 = 0, j3 = 0;//计算每门课的平均分
        double k1 = 0, k2 = 0, k3 = 0;//计算每门课标准差
        double l1 = 0, l2 = 0, l3 = 0;//计算每门课中位数
        double sum2 = 0;
        for (int i = 0; i < a1.length; i++) {
            sum2+=a1[i];
        }
        j1 = (sum2*1.0)/30;
        System.out.println("生物化学的班级平均分为:"+j1);
        double Sum = 0;
        for (int i = 0; i < a2.length; i++) {
            Sum+=a2[i];
        }
        j2 = (Sum*1.0)/30;
        System.out.println("微生物学的班级平均分为:"+j2);
        double sum = 0;
        for (int i = 0; i <a3.length; i++) {
            sum+=a3[i];
        }
        j3 = (sum*1.0)/30;
        System.out.println("人体组织解剖学的班级平均分为:"+j3);

        double c1 = 0,c2 = 0,c3 = 0;
        for (int i = 0; i < a1.length; i++) {
            c1+= (a1[i] - j1)*(a1[i] - j1);
        }
        k1 = Math.sqrt(c1*1.0/30);
        System.out.println("生物化学的班级标准差为:"+k1);

        for (int i = 0; i < a2.length; i++) {
            c2+= (a2[i] - j2)*(a2[i] - j2);
        }
        k2 = Math.sqrt(c2*1.0/30);
        System.out.println("微生物学的班级标准差为:"+k2);

        for (int i = 0; i < a3.length; i++) {
            c3+= (a3[i] - j3)*(a3[i] - j3);
        }
        k3 = Math.sqrt(c3*1.0/30);
        System.out.println("人体组织解剖学的班级标准差为:"+k3);
//
//        Arrays.sort(a1);
//        Arrays.sort(a2);
//        Arrays.sort(a3);
//        l1 =( a1[15]+a1[16])*1.0/2;
//        l2 =( a2[15]+a2[16])*1.0/2;
//        l3 =( a3[15]+a3[16])*1.0/2;
//        System.out.println("生物化学的中位数为:"+l1);
//        System.out.println("微生物学的中位数为:"+l2);
//        System.out.println("人体组织解剖学的中位数为:"+l3);
    }
}
